<?php
namespace app\admin\controller;
use \think\Controller;
use \think\Session;
use \think\Db;
class Newsreply extends Common
{
	public function index(){

		
		$result = Db::name('newsreply')->where('a.comment_id',input('commentid'))->alias('a')->join('user b','a.user_id = b.user_id')->join('newscomment c','a.comment_id=c.comment_id')->order('reply_id')->select();	
		$this->assign('replylist',$result);
		return $this->fetch();
	}

	public function delete(){
		$result = Db::name('newsreply')->where('reply_id',input('id'))->update(['reply_status'=>input('status')]);
		if ($result) {
        	$this->redirect(url('newsreply/index',['commentid'=>input('commentid')]));
        }
        else {
        	$this->error("修改失败");
        }
	}
}